export default class FrameTime {
    /**
     * 毫秒转秒
     * @param milli 
     * @returns 
     */
    public static millisecondTransformSecond(milli: number): number {
        return milli / 1000 | 0;
    }

    /**
     * 秒转分钟(保留两位小数)
     * @param second 
     * @returns 
     */
    public static secondTransformMin(second: number): number {
        return Number((second / 60).toFixed(2));
    }

    /**
     * 分钟转毫秒
     * @param min 
     * @returns 
     */
    public static minTranformMillisecond(min: number): number {
        return min * 60 * 1000;
    }

    /**
     * 秒转化为标准时间格式
     * @param second 
     */
    public static secondTransformTime(s: number): string {
        let hour = s / 60 / 60 | 0;
        let min = (s - (hour * 60 * 60)) / 60 | 0;
        let second = s % 60;

        let hourStr = hour >= 10 ? hour + "" : `0${hour}`;
        let minStr = min >= 10 ? min + "" : `0${min}`;
        let secondStr = second >= 10 ? second + "" : `0${second}`;
        return `${hourStr}:${minStr}:${secondStr}`;
    }
}